package academic.ui.server;

import java.util.List;
import java.util.Map;

import org.apache.torque.TorqueException;
import org.apache.torque.util.Criteria;

import torque.generated.City;
import torque.generated.CityPeer;
import torque.generated.Zones;
import torque.generated.ZonesPeer;

public class SocoEngine {

	public static String SESSION_KEY="socoEngine";
	
	private UserManager userMgr;
	private OrderManager orderMgr;
	
	private List<City> cities;
	private List<Zones> zones;
	
	public static String sslUrl = "ssl Url goes here";
	public static String sslPort = "ssl port goes here";
	
	private Map<String,String> configOptions;
	
	private City city;
	
	public SocoEngine() {
		this.userMgr=new UserManager();
		this.orderMgr=new OrderManager();
		setCities();
		setZones();
	}
	
	public void setCities() {
		try {
			cities = CityPeer.doSelect(new Criteria());
			city=cities.get(0);
		} catch (TorqueException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public List<City> getCities() {
		return cities;
	}
	
	private void setZones() {
		try {
			zones = ZonesPeer.doSelect(new Criteria());
		} catch (TorqueException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public List<Zones> getZones() {
		return zones;
	}
	
	public UserManager getUserMgr() {
		return userMgr;
	}


	public OrderManager getOrderMgr() {
		return orderMgr;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public City getCity() {
		return city;
	}
}
